/**
 * 
 */
package com.fsoft.tinhcd.entity;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

/**
 * @author caodangtinh
 * 
 */
@Entity
@Table(name = "employee", schema = "manytomany")
public class Employee {
	private int employeeId;
	private String firstName;
	private String lastName;
	private Set<Metting> mettings = new HashSet<Metting>();

	public Employee() {
		// TODO Auto-generated constructor stub
	}

	/**
	 * @param firstName
	 * @param lastName
	 */
	public Employee(String firstName, String lastName) {
		super();
		this.firstName = firstName;
		this.lastName = lastName;
	}

	/**
	 * @return the employeeId
	 */
	@Id
	@GeneratedValue
	@Column(name = "EMPLOYEE_ID")
	public int getEmployeeId() {
		return employeeId;
	}

	/**
	 * @param employeeId
	 *            the employeeId to set
	 */
	public void setEmployeeId(int employeeId) {
		this.employeeId = employeeId;
	}

	/**
	 * @return the firstName
	 */
	@Column(name = "FIRST_NAME", length = 50)
	public String getFirstName() {
		return firstName;
	}

	/**
	 * @param firstName
	 *            the firstName to set
	 */
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	/**
	 * @return the lastName
	 */
	@Column(name = "LAST_NAME", length = 50)
	public String getLastName() {
		return lastName;
	}

	/**
	 * @param lastName
	 *            the lastName to set
	 */
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	/**
	 * @return the mettings
	 */
	@ManyToMany(cascade = CascadeType.ALL)
	@JoinTable(name = "EmployeeMetting", joinColumns = { @JoinColumn(name = "EMPLOYEE_ID") }, inverseJoinColumns = { @JoinColumn(name = "METTING_ID") })
	public Set<Metting> getMettings() {
		return mettings;
	}

	/**
	 * @param mettings
	 *            the mettings to set
	 */
	public void setMettings(Set<Metting> mettings) {
		this.mettings = mettings;
	}

}
